<?php
/**
 * Created by PhpStorm.
 * User: lzy
 * Date: 2019/5/24
 * Time: 11:01
 */

namespace App\Http\Controllers\Api;


use App\Http\Repositories\Services\IRegion;
use App\Util\ResultsVo;
use Illuminate\Http\Request;

class RegionController
{
    public $regionService;

    public function __construct(IRegion $regionService)
    {
        $this->regionService = $regionService;
    }

    public function lists(Request $request)
    {
        $search = [];
        $search['parent_id'] = $request->get('parent_id',1);
        $data = $this->regionService->lists($search);
        return response()->json(new ResultsVo(['data'=>$data->toArray()],['id','name'],[]));
    }
}